
#ifndef REPING_USER_H
#define REPING_USER_H

/** I N C L U D E S **********************************************************/
#include "GenericTypeDefs.h"
#include "usb_config.h"
#include "types.h"

#define mInitButton1()				TRISBbits.TRISB5=1;

#define clearInterrupt()			INTCONbits.RBIF=0;		// Clear RB Port Change Interrupt Flag bit
#define enableInterrupt()			INTCONbits.RBIE=1;		// Enables the RB port change interrupt
#define clearTimerInterrupt()		INTCONbits.T0IF=0;		//Clear Timer interrupt
#define enableTimerInterrupt()		INTCONbits.TMR0IE=1;	//Enables the Timer0 interrupt
#define enableADCInterrupt()		PIE1bits.ADIE = 1;		//Enables the ADC interrupt
#define disableADCInterrupt()		PIE1bits.ADIE = 0;
#define setADCInterruptPrioHigh()	IPR1bits.ADIP = 1;
#define clearADCInterrupt()			PIR1bits.ADIF = 0;		//Clear ADC interrupt
#define enableGlobalInterrupt()		INTCONbits.GIE=1;
#define disableGlobalInterrupt()	INTCONbits.GIE=0;
#define cntrlTimer(x)				T0CON = x; //0b10010101;
#define cntrlClock(x)				T1CON = x;
//#define setupClock()				T1CON = gt1con; //0b11111101;
#define enableADC()					ADCON0bits.ADON = 1
#define disableADC()				ADCON0bits.ADON = 0
#define startADC()					ADCON0bits.GO = 1
#define isADCstarted()				ADCON0bits.GO
#define isADCdone()					!ADCON0bits.DONE
#define selectADCChannel0()			ADCON0 = gadcon0; //0b00000000;
//#define setupADC()					ADCON1 = gadcon1; //0b00001110;
//#define setupTimer()				TMR0H=0b00001111; TMR0L=0b11111111;


#define button1						PORTBbits.RB5

/** S T R U C T U R E S ******************************************************/

/** P U B L I C  P R O T O T Y P E S *****************************************/
void UserInit(void);
void ProcessIO(void);

void setupTimer (TMR0H_T th, TMR0L_T tl);
void setupClock (TMR1H_T th, TMR1L_T tl);
void setupADC1 (ADCON1_T adcon1);
void setupADC2 (ADCON2_T adcon2);

void adc_getdata (POLL_ID_T id, ADC_DATA *pd);
#endif

